import QtQuick 1.0
//import ShellInvoker 1.0
import "../../../../common/lib/kdeadmouseutils-build-desktop"
import "../Commons"

Item {
    
    Settings{
      id: setting
    }
    
    Action{
      id: shellAct
      serverPath:setting.serverPath
    }
    height: 180
    width:700
    id: detailVItem
    focus: true
    
    ListModel {
	  id : actVModel1
	  ListElement {
	      name : 'close'
	      action:'fermer_fenetre'
	  }
	  
	  ListElement {
	      name : 'droit'
	      action:'afficher_droit'
	  }
	  ListElement {
	      name : 'gauche'
	      action:'afficher_gauche'
	  }
	  ListElement {
	      name : 'haut'
	      action:'afficher_haut'
	  }
	  ListElement {
	      name : 'bas'
	      action:'afficher_bas'
	  }
	  ListElement {
	      name : 'minimize'
	      action:'afficher_minimize'
	  }
	  ListElement {
	      name : 'maximize'
	      action:'afficher_maximize'
	  }
	  ListElement {
	      name : 'winSwitch'
	      action:'start_SWU'
	  }
	  ListElement {
	      name : 'barreVert'
	      action:'barre_unity'
	  }
    }
   
    
    
    Connections {
      target: stdin
      onInputLine : {
	console.log('=======****'+inputLine);
	//actListRect.focus=true;
      }
      onShow : {
	console.log('=====onShow==****');
	//actListRect.focus=true;
      }
    }
    
    Connections {
      target: qmlviewer
      onFocusOut : {
	qmlviewer.hide();
      }
      onShow : {
	console.log('=====onShow=----=****');
      }
    }
    
    
    Rectangle {
      anchors.fill:parent
      border{color:setting.color1;width:4}
      color: setting.backgroundColor
      radius:4
      opacity: 0.5
    }
      
    ListView {
	    id: listVModel1
	    height: parent.height - 50
	    width: 150
	    anchors.centerIn : parent
	    focus: true
	    model:actVModel1
	    cacheBuffer : width * 2
	    orientation : ListView.Horizontal
	    spacing : 35
	    delegate: MoveWin {
			    id:rectItem
			    bas : 'bas'==name
			    haut : 'haut'==name
			    gauche : 'gauche'==name
			    droit :'droit'==name
			    maximize : 'maximize'==name
			    minimize :  'minimize'==name
			    close : 'close'==name
			    winSwitch : 'winSwitch'==name
			    barreVert : 'barreVert'==name
			    //focus: true
			    states: State {
				  name: "active"; when: rectItem.activeFocus
				  PropertyChanges { target: rectItem
						    scale: 1.2
				  }
			      }

			      transitions: Transition {
				  NumberAnimation { properties: "scale"; duration: 100 }
			      }
			    
			    //handle events here
			    Keys.onReturnPressed : {
			      console.log('<'+action+'> pressed');
			      //ex:xdotool key ctrl+super+Right
				shellAct.execAndExit(action);
			    }  
			  }
	    
    }
	      
    
}
 
